package repository

import (
	"react-blog-server/app/dao"
	"react-blog-server/app/dao/model"
)

var UserRepo = new(userRepo)

type userRepo struct{}

func (a *userRepo) GetUserByName(name string) (*model.User, error) {
	var user model.User
	if err := dao.DB.Where("user_name = ?", name).First(&user).Error; err != nil {
		return nil, err
	}
	return &user, nil
}
